home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 2.7 KB | 61 lines | [TEXT/GEOL] |
- Item 5220358 17-Jan-90 09:40
-
- From: MADA2 MacApp Dev Assoc, Curtis Faith
-
- To: AUST0134 Jam Software Sydney
-
- cc: MACAPP.TECH$ MacApp Technical
-
- Sub: RE:InsideOut ErrorHandling
-
- Tseung,
-
- I have spent considerable time thinking about InsideOut and MacApp and their
- relationship. I have come to the conclusion that the best thing to do about
- InsideOut error handlers is to dispense with them altogether.
-
- While the InsideOut scheme is laudable and otherwise excellent it is difficult
- to fit it into the MacApp scheme, as is evidenced by your scheme's admitted
- convolution.
-
- MacApp has its own Failure mechanism that is more general and also quite
- excellent and thus in the interest of uniformity and readability I have
- implemented the following scheme:
-
- 1) I have place a layer of abstraction between InsideOut calls and My
- application. This has the effect of simplifying the interface for the usual
- case and also allows one to handle InsideOut errors in a uniform way. Here is
- my interface for the Insert call:
-
- PROCEDURE TInsideOutDB.Insert (theDBRefNum: Integer;
- theData: UNIV Ptr;
- doHandleErrors: Boolean);
-
- 2) If doHandleErrors is TRUE then the method calls another routine HandleError
- which checks the result of DBError and if it is not noErr (or 0) it will call
- failure with the result of DBError as the error parameter and a special message
- number for InsideOut Errors that will call up a dialog box with the normal
- 'errs' resource stuff.
-
- 3) At times one may not want an error to always result in a call to failure as
- some errors may be normal. If one is reading in a list of records using the
- Next call one should expect kNoNextRec as a normal result of reaching the end
- of the set of records that match . Thus in this case one can call Next with
- doHandleErrors FALSE and then explicitly test the error, calling HandleError if
- an error is neither kNoNextRec nor noErr.
-
- Thus the abnormal or unexpected case results in a call to failure. One can use
- one MacApp failure handler to do what one might have done within an InsideOut
- failure handler and also clean up MacApp objects.
-
- I think that in most instances it is preferable to have one mechanism if one
- can serve the same purpose as two. Generally, one failure handler is all that
- is needed since it usually matters little whether failure comes about as the
- result of an InsideOut call or something else. One can just as easily test for
- specific InsideOut errors inside a MacApp failure handler as an InsideOut one.
-
- I have found the above scheme to be quite workable and satisfactory.
-
- - Curtis
-
-